<?php

/**
 * LigneCaisse form base class.
 *
 * @method LigneCaisse getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLigneCaisseForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'id_caisse_source'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CaisseSource'), 'add_empty' => false)),
      'id_caisse_destination'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CaisseDestination'), 'add_empty' => true)),
      'id_employe_destination' => new sfWidgetFormInputText(),
      'id_employe_source'      => new sfWidgetFormInputText(),
      'id_versement'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('VersementCaisse'), 'add_empty' => false)),
      'date'                   => new sfWidgetFormDate(),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
      'deleted_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_caisse_source'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CaisseSource'))),
      'id_caisse_destination'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CaisseDestination'), 'required' => false)),
      'id_employe_destination' => new sfValidatorInteger(array('required' => false)),
      'id_employe_source'      => new sfValidatorInteger(),
      'id_versement'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('VersementCaisse'))),
      'date'                   => new sfValidatorDate(),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
      'deleted_at'             => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ligne_caisse[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LigneCaisse';
  }

}
